﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX;

namespace BurningSphere.Simulator.Controls
{
	/// <summary>
	/// Makes the laser pause for a specified number of frames
	/// </summary>
	public class LaserPause : LaserControl
	{
		int pause = 100;

		/// <summary>
		/// Ctor
		/// </summary>
		public LaserPause()
		{
		}

		/// <summary>
		/// Ctor
		/// </summary>
		/// <param name="pause">Pause time in frames</param>
		public LaserPause(int pause)
		{
			this.pause = pause;
		}

		/// <summary>
		/// False = don't show
		/// </summary>
		public override bool LaserStatus
		{
			get
			{
				return false;
			}
		}

		/// <summary>
		/// Pause time in frames
		/// </summary>
		public int Frames
		{
			get
			{
				return pause;
			}
			set
			{
				pause = value;
			}
		}

		/// <summary>
		/// Don't do anything
		/// </summary>
		public override Matrix LaserMatrix
		{
			get
			{
				return Matrix.Identity;
			}
		}

		/// <summary>
		/// Return false when the frame pause is up
		/// </summary>
		/// <returns></returns>
		public override bool MoveNext()
		{
			return pause != 0;
		}

		/// <summary>
		/// Iterate the pause counter
		/// </summary>
		/// <param name="matrix"></param>
		public override void Update(Matrix matrix)
		{
			if (pause > 0)
			{
				pause--;
			}
		}
	}
}
